package top.datacluster.basic.algorithm.leetcode.dynamic;

public class LeetCode53 {

    public boolean isSubsequence(String s, String t) {
        if (s.isEmpty()){
            return true;
        }
        if (s.length() == t.length()){
            if (s.equals(t)){
                return true;
            }else{
                return false;
            }
        }
        int i = 0;
        int j = 0;
        while (i < s.length()){

            while (j < t.length()){
                if (s.charAt(i) == t.charAt(j)){
                    j++;
                    break;
                }else{
                    j++;
                }
            }

            i++;
        }
        return i == s.length();
    }

    public static void main(String[] args) {
        System.out.println(new LeetCode53().isSubsequence("b", "c"));
    }
}
